package com.tommy.ddp.disposeHandler.special
{
	import com.tommy.ddp.GridDataManager;
	import com.tommy.ddp.MainManager;
	import com.tommy.ddp.box.DdpBox;
	import com.tommy.ddp.definition.GameStatus;
	import com.tommy.ddp.manager.DisposeBoxManager;
	import com.tommy.ddp.manager.FillUpManager;
	import com.tommy.ddp.manager.GameStatusManager;
	
	import flash.utils.setTimeout;

	/**
	 * 清除所有的
	 * @author hongxuan
	 * 
	 */	
	public class DisposeAllBoxHandler implements ISpecialDisposeHandler
	{
		private var _vect:Vector.<DdpBox>;
		public function DisposeAllBoxHandler()
		{
		}
		
		public function dispose(vect:Vector.<DdpBox>,n:Number):void
		{
			_vect = vect;
			MainManager.game.tips = "清除所有的糖果";
			setTimeout(_dispose,n);
		}
		
		private function _dispose():void
		{
			var arr:Array = GridDataManager.allBox;
			
			for each(var i:DdpBox in arr)
			{
				DisposeBoxManager.addDisposeBox(i);
			}
			_vect = null;
			//
			//FillUpManager.fillUp();
			GameStatusManager.changeStatus(GameStatus.BEGIN_FILL);
		}
	}
}